/**
* @file TableFileReader.hpp
* Class to read and store the leapsec data.
*/

#ifndef GPSTK_TABLE_FILE_READER_HPP
#define GPSTK_TABLE_FILE_READER_HPP


//============================================================================
//
//  Shoujian Zhang, Wuhan University, 2019.4.24
//
//============================================================================


#include <iostream>
#include <string>
#include <set>
#include <map>
#include "CommonTime.hpp"

#include "BLQDataReader.hpp"
#include "AntexReader.hpp"
#include "TropModel.hpp"
#include "SolarSystem.hpp"
#include "LeapSecStore.hpp"
#include "EOPDataStore.hpp"



using namespace std;

namespace gpstk
{


      /** This class will read the data from the files givien 
       *  in the configuration file, mainly consists:
       *  (1) eopfile;
       *  (2) leap sec file;
       *  (3）jpl ephemeris file;
       *  (4) antex file from IGS;
       *  (5) blq file;
       *  (6) trop file, e.g. vinenna;
       */

   class TableFileReader
   {
   public:


         /// Default constructor
      TableFileReader()
          :
          pEOPStore(NULL),
          pLeapSecStore(NULL),
          pSolarSys(NULL),
          pAntexReader(NULL),
          pBLQReader(NULL),
          pViennaTM(NULL)
      {};


         /// Load the leap second data from input file
      void load()
         noexcept(false);


      TableFileReader& setEOP(string eopFile, EOPDataStore& eopStore )
      {
          eopFileName = eopFile;
          pEOPStore = &eopStore;
          return (*this);
      };

      TableFileReader& setLeapSec(string leapFile, LeapSecStore& leapStore )
      {
          leapSecFileName = leapFile;
          pLeapSecStore = &leapStore;
          return (*this);
      };

      TableFileReader& setSolarSys(string jplFile, SolarSystem& solarSys)
      {
          jplFileName = jplFile;
          pSolarSys= &solarSys;
          return (*this);
      };

      TableFileReader& setAntex(string atxFile, AntexReader& antexReader)
      {
          atxFileName = atxFile;
          pAntexReader= &antexReader;
          return (*this);
      };

      TableFileReader& setBLQ(string blqFile, BLQDataReader& blqReader)
      {
          blqFileName = blqFile;
          pBLQReader = &blqReader;
          return (*this);
      };

      TableFileReader& setTrop(string tropFile, ViennaTropModel& viennaTM)
      {
          gpt2FileName = tropFile;
          pViennaTM= &viennaTM;
          return (*this);
      };


         /// clear the all the data
      void clear()
      {}


         /// Default deconstructor
      virtual ~TableFileReader()
      {}


   private:

      string eopFileName      ;
      string leapSecFileName  ;
      string jplFileName      ;
      string atxFileName      ;
      string blqFileName      ;
      string gpt2FileName     ;


      EOPDataStore*    pEOPStore;
      LeapSecStore*    pLeapSecStore;
      SolarSystem*     pSolarSys;
      AntexReader*     pAntexReader;
      BLQDataReader*   pBLQReader;
      ViennaTropModel* pViennaTM;


   }; // End of class 'TableFileReader'

      // @}

}  // End of namespace gpstk


#endif   // GPSTK_TABLE_FILE_READER_HPP
